window.requestAnimationFrame=(
	window.webkitRequestAnimationFrame ||
	window.mozRequestAnimationFrame    ||
	window.msRequestAnimationFrame     ||
	window.oRequestAnimationFrame      ||
	function (callback){
		return window.setTimeout(callabck,1000/60);
	}
);

window.tools.getKey=function(){
	var key={};
	window.addEventListener("keydown",function(e){
		if (e.keyCode==38||e.keyCode==87){
			key.direction="up";
		}else if(e.keyCode==39||e.keyCode==68){
			key.direction="right";
		}else if(e.keyCode==40||e.keyCode==83){
			key.direction="down";
		}else if(e.keyCode==37||e.keyCode==65){
			key.direction="left";
		}else{
			key.direction="";
		}
	},false);
	return key;
}